//
//  LGFollowNoneDataHeader.m
//  HeartDiseaseManage
//
//  Created by 1234 on 2023/6/21.
//  暂无记录--区头

#import "LGFollowNoneDataHeader.h"

@interface LGFollowNoneDataHeader()
/**   */
@property (nonatomic , strong)UIView *baseView;
/**   */
@property (nonatomic , strong)UIImageView *iconView;
/**   */
@property (nonatomic , strong)UILabel *titleLabel;
/**   */
@property (nonatomic , strong)UILabel *subtitleLabel;
/**   */
@property (nonatomic , strong)UIView *lineView;
@end

@implementation LGFollowNoneDataHeader

- (instancetype)initWithFrame:(CGRect)frame{
    self = [super initWithFrame:frame];
    if (self) {
        [self createSubView];
    }
    return self;
}

-(void)setTitle:(NSString *)title{
    _title = title;
    self.iconView.image = [UIImage imageNamed:[NSString stringWithFormat:@"添加随访-%@",title]];
    self.titleLabel.text = title;
}

-(void)setSubTitle:(NSString *)subTitle{
    _subTitle = subTitle;
    self.subtitleLabel.text = subTitle;
    self.lineView.hidden = (subTitle.length>0)?YES:NO;
}

#pragma mark
#pragma mark ====> 创建控件
-(void)createSubView{
    self.clipsToBounds = YES;
    self.backgroundColor = [UIColor colorWithString:@"#F9F9F9"];
    [self addSubview:self.baseView];
    [self.baseView addSubview:self.iconView];
    [self.baseView addSubview:self.titleLabel];
    [self.baseView addSubview:self.subtitleLabel];
    [self.baseView addSubview:self.lineView];
    [self.baseView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.bottom.equalTo(self).offset(viewPix(8));
        make.left.equalTo(self).offset(viewPix(16));
        make.right.equalTo(self).offset(-viewPix(16));
    }];
    [self.iconView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.baseView).offset(viewPix(20));
        make.top.left.equalTo(self.baseView).offset(viewPix(12));
        make.width.height.equalTo(@(viewPix(24)));
    }];
    [self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.iconView.mas_right).offset(viewPix(6));
        make.centerY.equalTo(self.iconView);
    }];
    [self.subtitleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.equalTo(self.baseView).offset(-viewPix(12));
        make.centerY.equalTo(self.iconView);
    }];
    [self.lineView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.baseView).offset(viewPix(12));
        make.right.equalTo(self.baseView).offset(-viewPix(12));
        make.top.equalTo(self.baseView).offset(viewPix(46));
        make.height.equalTo(@(0.5));
    }];
}
    
-(UIView *)baseView{
    if(!_baseView){
        _baseView = [UIView shadowViewWithColor:@"#B3C5D9" offset:CGSizeMake(0, 2) opacity:0.15 radius:10];
        _baseView.backgroundColor = [UIColor whiteColor];
    }
    return _baseView;
}

-(UIImageView *)iconView{
    if(!_iconView){
        _iconView = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@""]];
    }
    return _iconView;
}

-(UILabel *)titleLabel{
    if(!_titleLabel){
        _titleLabel = [UILabel lableWithText:@"" colorString:@"#333333" textFont:LGFontWeight(15, UIFontWeightMedium) textAlignment:NSTextAlignmentLeft lines:1];
    }
    return _titleLabel;
}

-(UILabel *)subtitleLabel{
    if(!_subtitleLabel){
        _subtitleLabel = [UILabel lableWithText:@"暂无记录" colorString:@"#999999" textFont:LGFont(14) textAlignment:NSTextAlignmentRight lines:1];
    }
    return _subtitleLabel;
}
-(UIView *)lineView{
    if(!_lineView){
        _lineView = [[UIView alloc] init];
        _lineView.backgroundColor = [UIColor colorWithString:@"#E8E8E8"];
    }
    return _lineView;
}

@end
